<?php


/**
 * Plugin to initialize application state
 *
 * @uses       Zend_Controller_Plugin_Abstract
 * @version    $Id: $
 */
class WSB_Controller_Plugin_Debugger extends Zend_Controller_Plugin_Abstract
{

	public function preDispatch(Zend_Controller_Request_Abstract $request)
	{
		$infos = '';
		$infos .= sprintf('<pre style="margin-bottom:1em;">REQUEST %s</pre>', $_SERVER['REQUEST_URI']);
		$infos .= Zend_Debug::dump($_GET, 'GET', false);
		$infos .= Zend_Debug::dump($_POST, 'POST', false);
		$infos .= Zend_Debug::dump($_SESSION, 'SESSION', false);
		$infos .= Zend_Debug::dump($_SERVER, 'SERVER', false);
		$messages = '<div style="position:fixed;bottom:0;width:100%;height:18%;background-color:white;border:1px solid red;overflow:auto;"><div style="background-color:red;color:white;font-weight:bold;padding:2px;">DEBUG</div><div style="padding:5px;">' . $infos . '</div></div>';
		$this->getResponse()->append('debug', $messages);
	}

}
